<template>
   <div class="box-inline" :class="{'text-link':pCategory!='0'}" @click='linkChange'>
      <template v-if="!this.$slots.default">
         <status-label :p-data="pCategory" :p-name='"message_category"' :p-far='true'></status-label><!--<b class="badge badge-pill badge-primary m-l-xs text-white" v-if='pCategory!="0"'>{{pValue}}</b>-->
      </template>
      <slot></slot>
   </div>
</template>
<script>
   import {GET_FAR_STATUS} from '../../serves/data-status'
    export default{
        name:'CLabelMsgInset',
       props:{
          pType:{
             type:String,
             default:''
          },
          pValue:{
             type:String,
             default:''
          },
          pCategory:{
             type:String,
             default:''
          }
       },
       computed:{
          types(){
             return GET_FAR_STATUS('message_category',true,'code')
          }
       },
        data(){
            return{
                
            }
        },
       mounted(){
       },
       methods:{
          linkChange(){
            if(this.pCategory!='0'&&this.types[this.pCategory]&&this.types[this.pCategory].router){
               var d;
               if(this.pCategory=='3'){
                  d = Object.assign({params:{id:this.pValue,msgType:this.pType}},this.types[this.pCategory].router)
               }else {
                  d = Object.assign({params:{id:this.pValue}},this.types[this.pCategory].router)
               }
               this.$emit('on-link',d);
            }else{
                this.$emit('on-link',false);
            }
          }
       },
        components:{
        }
    }
</script>